import { VAR } from "../introduce.js"

const userInfo = document.querySelector(".userInfo .num")
const phoneNum = document.querySelector(".userInfo .phoneNum span")
const get = JSON.parse(localStorage.getItem("loginUeser"))
phoneNum.innerText = get[get.length - 1].tel

const bottomStyle = document.querySelectorAll(".bottomStyle div a")
bottomStyle.forEach(function (item) {
	item.addEventListener("click", function () {
		document.querySelector(".redSel").classList.remove("redSel")
		item.classList.add("redSel")
	})
})

const car = document.querySelector(".car")
car.addEventListener("click", function () {
	location.href = "./VehicleInformation.html"
})
const mission = document.querySelector(".mission")
mission.addEventListener("click", function () {
	location.href = "./missionData.html"
})
const systemSet = document.querySelector(".systemSet")
systemSet.addEventListener("click", function () {
	location.href = "./systemSettings.html"
})

const topActive = document.querySelector(".topActive")
const topActiveImg = document.querySelector(".topActive img")
new AlloyFinger(document.body, {
	swipe: function (evt) {
		if (evt.direction == "Down") {
			topActive.style.height = 150 / 37.5 + "rem"
			topActiveImg.style.height = 150 / 37.5 + "rem"
			topActiveImg.style.opacity = 1
			setTimeout(function () {
				topActive.style.height = 0
				topActiveImg.style.height = 0
				topActiveImg.style.opacity = 0
			}, 1300)
		}
		if (evt.direction == "Up") {
			topActive.style.height = 0
			topActiveImg.style.height = 0
			topActiveImg.style.opacity = 0
		}
	}
})

//点击任务
teskBtn.addEventListener("touchstart", function () {
	location.href = "./mainFunctionPage.html"
})
//点击消息
informationBtn.addEventListener("touchstart", function () {
	location.href = "../module02/message.html"
})
